#测试局部变量和全局变量效率
import time

#局局变量
a=1000
def test01():
    start=time .time()
    global a
    for i in range(100000000):
        a+=1
    end=time.time()
    print('耗时{0}'.format((end-start)))

#全部变量
def test02():
    c = 1000
    start=time .time()

    for i in range(100000000):
        c+=1
    end=time.time()
    print('耗时{0}'.format((end-start)))
test01()
test02()